﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
        xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
        x:Class="GUI.MainWindow" Title="Treadmill App" Height="600" Width="1024" WindowStartupLocation="CenterScreen">


    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="_FILE">
                <MenuItem Header="_Save" Click="Save_Click" />
                <MenuItem Header="_Open" Click="Open_Click" />
                <MenuItem Header="_Exit" Click="onExit_Click"/>
            </MenuItem>
            <MenuItem Header="_VIEW">
                <CheckBox x:Name="CBPulseGraph" Content="_Pulse graph" HorizontalAlignment="Left" Height="24"
                          VerticalAlignment="Top" Width="127" Click="GraphsVisible" IsChecked="True" />
                <CheckBox x:Name="CBSpeedGraph" Content="_Speed graph" HorizontalAlignment="Left" Height="24"
                          VerticalAlignment="Top" Width="127" Click="GraphsVisible" IsChecked="True" />
                <CheckBox x:Name="CBTrainingProgramGraph" Content="Training program" HorizontalAlignment="Left"
                          Height="24" VerticalAlignment="Top" Width="127" Click="GraphsVisible" IsChecked="True" />
                
            </MenuItem>
            <MenuItem Header="_TRAINING">
                <MenuItem Header="_Select training session" Click="MISelectTrainingSession" />
            </MenuItem>

            <MenuItem Header="_Connection">
                <MenuItem x:Name="ConnectToServer" Header="_Connect to treadmill" Click="ConnectToServer_Click" />
                <MenuItem x:Name="CloseConnection" Header="_Close Connection" IsEnabled="False"
                          Click="CloseConnection_Click" />
            </MenuItem>

            <MenuItem Header="_HELP">
                <MenuItem Header="_About" Click="MIAbout_Click" />
            </MenuItem>

        </Menu>

        <TabControl>
            <TabItem Header="Graphs" HorizontalAlignment="Left" Height="20" Margin="0" VerticalAlignment="Top"
                     Width="55">
                <Grid ShowGridLines="True" Background="AliceBlue">
                    <!-- Define the rows / columns -->
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40*" />
                        <RowDefinition Height="40*" />
                        <RowDefinition Height="40*" />
                        <RowDefinition Height="40*" />
                    </Grid.RowDefinitions>

                    <!-- adding elements to the grid's cells-->
                    <!-- (0,0) -->
                    <Label x:Name="lbPulseGraph" Grid.Column="0" Grid.Row="0" Content="pulseGraph" Margin="0,14" />

                    <d3:ChartPlotter x:Name="pulseGraphChart" Grid.Column="0" Grid.Row="0">
                        <d3:Header TextBlock.FontSize="20" Content="Pulse Graph" Foreground="#FFEC2424"
                                   FontWeight="Bold" />
                        <d3:VerticalAxisTitle Content="Time" />
                        <d3:HorizontalAxisTitle Content="Pulse" />
                        <!--<d3:LineGraph x:Name="pulseGraphChartline" Stroke="#FF1D9E35" />-->

                    </d3:ChartPlotter>


                    <!-- (1,0) -->
                    <!--<Label x:Name="lbPosition2" Grid.Column="1" Grid.Row="0" Content="(1,0)" />-->
                    <!-- (0,1) -->
                    <Label x:Name="lbSpeedGraph" Grid.Column="0" Grid.Row="1" Content="SpeedGraph(0,1)" />
                    <d3:ChartPlotter x:Name="speedGraphChart" Grid.Column="0" Grid.Row="1">
                        <d3:Header TextBlock.FontSize="20" Content="Speed Graph" FontWeight="Bold"
                                   Foreground="#FF086421" />
                        <d3:VerticalAxisTitle Content="Time" />
                        <d3:HorizontalAxisTitle Content="Speed" />
                    </d3:ChartPlotter>
                    <!-- (1,1) -->
                    <!--<Label x:Name="lbPosition4" Grid.Column="1" Grid.Row="1" Content="(1,1)" />-->

                    <!--0,2-->
                    <!--<Label x:Name="lbTrainingProgramGraph" Grid.Column="0" Grid.Row="2"
                           Content="TrainingProgramGraph(0,2)" />-->

                    <chartingToolkit:Chart x:Name="trainingProgramGraphChartHead" Grid.Column="0" Grid.Row="2">
                        <chartingToolkit:ColumnSeries x:Name="trainingProgramGraphChart" DependentValuePath="Value"
                                                      IndependentValuePath="Key" ItemsSource="{Binding }"
                                                      IsSelectionEnabled="True" RenderTransformOrigin="0.5,0.5">
                        </chartingToolkit:ColumnSeries>
                    </chartingToolkit:Chart>


                    <!--0,3-->
                    <!--<Label x:Name="lbStatus" Grid.Column="0" Grid.Row="3">-->
                    <DockPanel x:Name="StatusPanel" Grid.Column="0" Grid.Row="3">
                        <Grid ShowGridLines="True" Background="AliceBlue">
                            <!-- Define the rows / columns -->
                            <Grid.RowDefinitions>
                                <RowDefinition Height="90*" />
                                <RowDefinition Height="90*" />
                                <RowDefinition Height="90*" />
                            </Grid.RowDefinitions>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="90*" />
                                <ColumnDefinition Width="90*" />
                                <ColumnDefinition Width="90*" />
                            </Grid.ColumnDefinitions>


                            <Label x:Name="LbCurrentPulse" Content="Current Pulse: " Grid.Column="0" Grid.Row="0"
                                   Foreground="#FFEC2424" FontSize="20">
                            </Label>
                            <Label x:Name="LbCurrentSpeed" Content="Current Speed: " Grid.Column="0" Grid.Row="1"
                                   Foreground="#FF086421" FontSize="20">
                            </Label>
                            <Label x:Name="LbCurrentGear" Content="Current Gear: " Grid.Column="0" Grid.Row="2"
                                   Foreground="#FF102BD8" FontSize="20">
                            </Label>

                            <Label x:Name="LbMaxPulse" Content="MAX Pulse: " Grid.Column="1" Grid.Row="0"
                                   Foreground="#FFEC2424" FontWeight="Bold" FontSize="20" />
                            <Label x:Name="LbMaxSpeed" Content="MAX Speed: " Grid.Column="1" Grid.Row="1"
                                   Foreground="#FF086421" FontWeight="Bold" FontSize="20">
                            </Label>

                            <Label x:Name="LbMaxGear" Content="MAX Gear: " Grid.Column="1" Grid.Row="2"
                                   Foreground="#FF102BD8" FontWeight="Bold" FontSize="20">
                            </Label>


                            <Button x:Name="BtStart" Content="Start" Grid.Column="3" Grid.Row="0"
                                    Background="#FF086421" FontWeight="Bold" FontSize="20" IsEnabled="False"
                                    Click="onStart_Click">
                            </Button>


                            <Button x:Name="BtReset" Content="Reset" Grid.Column="3" Grid.Row="1" Background="#FFEEE410"
                                    FontWeight="Bold" FontSize="20"  Click="onReset_Click">
                            </Button>


                            <Button x:Name="BtStop" Content="Stop" Grid.Column="3" Grid.Row="2" Background="#FFEC2424"
                                    FontWeight="Bold" FontSize="20" IsEnabled="False" Click="onStop_Click">
                            </Button>


                        </Grid>
                        <!--</Label>-->
                    </DockPanel>
                </Grid>
            </TabItem>

            <TabItem Header="PulseGraph" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Width="55">

                <StackPanel Width="250">
                    <Label Content="Move the scroll bar to see the current value" />
                    <!-- The scrollbar's value is the source of this data bind. -->
                    <ScrollBar x:Name="mySB" Orientation="Horizontal" Height="30" Minimum="1" Maximum="100"
                               LargeChange="1" SmallChange="1" />
                    <!-- The label's content will be bound to the scroll bar! -->
                    <Label x:Name="labelSBThumb" Height="30" BorderBrush="Blue" BorderThickness="2"
                           Content="{Binding Value, ElementName=mySB}" />
                </StackPanel>


            </TabItem>

        </TabControl>

    </DockPanel>
</Window>